<!DOCTYPE html>
<!-- saved from url=(0037)http://192.168.0.246:13606/login.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-Content-Type-Options" content="nosniff">
    <meta http-equiv="X-XSS-Protection" content="1; mode=block">
    <meta http-equiv="Content-Security-Policy" content="object-src &#39;none&#39;">
    <base href="/">
    <title>用户登录</title>
    <link rel="stylesheet" href="../static/css/layui.css">
    <link rel="stylesheet" href="../static/css/login.css" media="all">
    <link rel="stylesheet" type="text/css" href="../static/css/crown.css">
    <script type="text/javascript" src="../static/js/jquery-3.2.1.min.js"></script>
    <script>
        // <!--入口函数-->
        $(function () {
            $("#login").on("click",login);
            $("input[name='password']").on("keydown",function (event) {
                if (event.keyCode == 13){
                    login();
                }
            });
        });

        // 登录
        function login() {
            var account = $("#account").val();
            var password = $("#password").val();
            if (!account){
                var errorInfo = $("#errorInfo");
                errorInfo.text('请填写账号');
                errorInfo.show();
                return;
            }
            if (!password){
                var errorInfo = $("#errorInfo");
                errorInfo.text('请填写密码');
                errorInfo.show();
                return;
            }
            $.post({
                url: "admin/login",
                data: {
                    'account': account,
                    'password': password
                },
                success: function (result) {
                    if (result) {
                        if (!result.success){
                            var errorInfo = $("#errorInfo");
                            errorInfo.text(result.message);
                            errorInfo.show();
                        }else {
                            // 登录成功，跳转页面
                            window.location.href = '/static/'+result.data.url;
                        }
                    }
                }
            })
        }
    </script>
<link id="layuicss-layer" rel="stylesheet" href="../static/css/layer.css" media="all"></head>
<body class="body-bg">
<div class="login">
    <div class="login-img"><img src="../static/image/login-img.png"></div>
    <div class="login-box">
        <!--<div class="logo"><img id="login-logo" style="margin-left: -11%" src="../static/image/logo-sup.png"></div>-->
        <!--<div class="logo">员工信息后台管理系统</div>-->
        <ul>
            <li>
                <div>
                    <img src="../static/image/icon-user.png">
                    <input name="account" id="account" lay-verify="loginName" type="text" placeholder="请输入用户名">
                </div>
            </li>
            <li>
                <div>
                    <img src="../static/image/icon-pwd.png">
                    <input name="password" id="password" lay-verify="password" type="password" autocomplete="off" placeholder="请输入密码">
                </div>
            </li>
            <li><a id="login" href="javascript:void(0)" class="login-btn">登 录</a></li>
        </ul>
        <div class="login-error" id="errorInfo" style="display: none;">用户或密码错误，请重试。</div>
    </div>
</div>

</body></html>